A join and a groupby are common operations in a relational database system. A join operation is used to combine rows from two or more tables in the database based on a common field between them. A groupby operation is used in conjunction with aggregate functions to group a result set by one or more columns. Common techniques for performing a join operation includes the merge-sort, nested-loop, and hash join. However, none of these techniques recognize or consider skew in the join columns. Skew in join columns occur when distinct values in a column are not uniformly distributed across the rows of a table. Skewed data can affect the query execution plan of queries containing a predicate and queries containing a join operation. However, the above techniques for performing a join operation, and also common techniques for performing a groupby operation, fail to recognize or consider skew in the join or aggregate columns.